import { indexOf } from "lodash";
export const state = () => ({
  visible: false,
  contactList: [],
  contactId: "",
  sock: null
});
export const mutations = {
  setVisible(state, payload) {
    state.visible = payload.val;
  },
  setContactList(state, payload) {
    const { val } = payload;
    const i = indexOf(state.contactList, val);
    i !== -1 ? (state.contactList[i] = val) : state.contactList.push(val);
    state.contactId = val.id;
  },
  setContactId(state, payload) {
    state.contactId = payload.val;
  },
  setSock(state, payload) {
    state.sock = payload.val;
  }
};
export const actions = {
  setSock(ctx, payload) {
    ctx.commit("setSock", payload);
  }
};
